package com.gegong.vmware.workstation.exceptions;

import com.gegong.vmware.workstation.utils.VmxFileUtils;
import lombok.Data;

import java.io.File;

@Data
public class VmxFileException extends VMwareWorkstationManagementException {

    private File vmxFile;

    public VmxFileException(String message) {
        super(message);
    }

    public VmxFileException(String message, Throwable cause) {
        super(message, cause);
    }

    public static VmxFileException newReadSettingsException(File vmxFile, Throwable cause) {
        return new VmxFileException(String.format("从文件%s读取设置时发生异常", vmxFile.getAbsolutePath()), cause);
    }

    public static VmxFileException newAddSettingsException(File vmxFile, Throwable cause) {
        return new VmxFileException(String.format("写入设置信息到文件%s时发生异常", vmxFile.getAbsolutePath()), cause);
    }

    public static VmxFileException newCreateBakException(File vmxFile, Throwable cause) {
        return new VmxFileException(String.format("创建设置文件%s的备份失败", vmxFile.getAbsolutePath()), cause);
    }

}
